<!--- Default theme --->
<cfif config.css>
	<cfset config.cssLabelCode = true/>
	<cfif structKeyExists(config,'legend') and not structKeyExists(config,'classLegend')>
		<cfset config.cssCode.legend = ".legend{font-weight:bold;color:##344769;}"/>
		<cfset config.classLegend = "legend"/>
	</cfif>
</cfif>

<cfset tagList = "checkbox,radio"/>
<cfloop list="#tagList#" index="atag">
	<cfparam name="config.cssCode[atag]" default=""/>
	<cfloop from="1" to="#config[atag].size#" index="i">
		<cfparam name="config.class#atag##i#" default="#atag##i#"/>
		<cfset excludes = excludes & ",#evaluate('config.class#atag##i#')#"/>
		<cfif i gt 1>
			<cfset config.cssCode[atag] = config.cssCode[atag] & ".#atag##i#"/>
			<cfif i neq config[atag].size>
				<cfset config.cssCode[atag] = config.cssCode[atag] & ","/>
			</cfif>
		</cfif>			
	</cfloop>
	
	<cfif len(config.cssCode[atag])>
		<cfset config.cssCode[atag] = config.cssCode[atag] & "{display:-moz-inline-box; margin-left:10px; width:200px;}"/>
	</cfif>
	<cfif config[atag].size neq 0>
	<cfoutput>
		<cfsavecontent variable="config.cssCode.#atag#">
	#trim(config.cssCode[atag])#
	.#atag#1{display:-moz-inline-box; margin-left:120px; width:200px;}
	.#atag#First{display:-moz-inline-box; width:200px;}
		</cfsavecontent>
	</cfoutput>
	</cfif>		
</cfloop>
<cfoutput>
	<cfsavecontent variable="css">
	<cfif config.cssLabelCode>
	<style type="text/css">
	<cfif config.cssLabelCode>
	.label{float:left;width:120px;text-transform: capitalize;display:-moz-inline-box;}
	.required{color:red;}
	</cfif><cfoutput><cfloop collection="#config.cssCode#" item="css">
	#trim(config.cssCode[css])##chr(13)#</cfloop></cfoutput>
	 </style>
	</cfif>
	<cfif structKeyExists(config,'cssFiles')>
		<cfif isStruct(config.cssFiles)>
			<cfloop collection="#config.cssFiles#" item="i">
<link type="text/css" rel="stylesheet" href="#config.cssFiles[i]#"/>
			</cfloop>		
		<cfelseif isArray(config.cssFiles)>
			<cfloop from="1" to="#arraylen(config.cssFiles)#" index="i">
<link type="text/css" rel="stylesheet" href="#config.cssFiles[i]#"/>
			</cfloop>
		<cfelse>
			<cfloop list="#config.cssFiles#" index="i">
<link type="text/css" rel="stylesheet" href="#trim(i)#"/>
			</cfloop>
		</cfif>
	</cfif>
	</cfsavecontent>
	<cfset css = ReReplace(trim(css), '(?m)^\s+\r\n','', "ALL")>
	<cfhtmlhead text="#css#"/>

	<cfsavecontent variable="js">
	<cfif config.button.count>
	<script language="JavaScript">
	function getAction(formname, filename, confirmation){ 
		if(confirmation == undefined) {
			document[formname]["action"]=filename;
			document[formname]["submit"]();
		}
		else {
			if(confirm(confirmation)) {
				document[formname]["action"]=filename;
				document[formname]["submit"]();
			}
			return false
		}
	} 
	</script>
	</cfif>
	<cfif structKeyExists(config,'jsFiles')>
		<cfif isStruct(config.jsFiles)>
			<cfloop collection="#config.jsFiles#" item="i">
<script type="text/javascript" src="#config.jsFiles[i]#"></script>
			</cfloop>		
		<cfelseif isArray(config.jsFiles)>
			<cfloop from="1" to="#arraylen(config.jsFiles)#" index="i">
<script type="text/javascript" src="#config.jsFiles[i]#"></script>
			</cfloop>
		<cfelse>
			<cfloop list="#config.jsFiles#" index="i">
<script type="text/javascript" src="#trim(i)#"></script>
			</cfloop>
		</cfif>
	</cfif>
	</cfsavecontent>
	<cfset js = ReReplace(trim(js), '(?m)^\s+\r\n','', "ALL")>
	<cfhtmlhead text="#js#"/>

<cfsavecontent variable="thisTag.generatedContent">
<cfif structKeyExists(config,'legend')><fieldset><legend<cfif config.css OR structKeyExists(config,'classLegend')> class="#config.classLegend#"</cfif>>#config.legend#</legend>
</cfif>#trim(thisTag.generatedContent)#
<cfif config.showButtons>
<div id="form-buttons" style="margin-top: 12px">
<cfif config.showSubmit><button type="submit">#config.submit#</button></cfif>
<cfif arrayLen(config.submits)>
	<cfloop from="1" to="#arraylen(config.submits)#" index="i">
		<cfset button = config.submits[i]/>
<button type="submit"#getFieldAttributes(button,',text')#>#button.text#</button>
	</cfloop>
</cfif>
<cfif arrayLen(config.buttons)>
	<cfloop from="1" to="#arraylen(config.buttons)#" index="i">
		<cfset button = config.buttons[i]/>
<button type="submit"#getFieldAttributes(button,',action,addOnClick,message,text')#<cfif not structKeyExists(button,'onClick')> onclick="<cfif structKeyExists(button,'addOnClick')>#button.addOnClick#;</cfif>return getAction('#attributes.name#','#button.action#'<cfif structKeyExists(button,'message')>,'#button.message#'</cfif>)"</cfif>>#button.text#</button>
	</cfloop>
</cfif>
<cfif config.showReset><button type="reset">#config.reset#</button></cfif>
<cfif config.showCancel><button type="button" onclick="window.location='#config.cancelURL#'">#config.cancel#</button>
<noscript><a href="#config.cancelURL#">#config.cancel#</a></noscript></cfif>
<cfif arrayLen(config.cancels)>
	<cfloop from="1" to="#arraylen(config.cancels)#" index="i">
		<cfset button = config.cancels[i]/>
<button type="button"#getFieldAttributes(button,',action,text')#<cfif not structKeyExists(button,'onClick')> onclick="window.location='#button.action#'"</cfif>>#button.text#</button><noscript><a href="#button.action#">#button.text#</a></noscript>
	</cfloop>
</cfif>
</div>
</cfif>
<cfif structKeyExists(config,'legend')>
</fieldset>
</cfif>				
</cfsavecontent>
</cfoutput>
<cfinclude template="../#config.parent#/#tag#.cfm"/>